package com.digitalart.site.loader{
	
	
	import adobe.utils.CustomActions;
	
	import com.digitalart.commons.CustomAssetLoader;
	import com.digitalart.commons.CustomEvent;
	import com.digitalart.siteBuilder.loader.Loader;
	
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.events.Event;
	
	public class DigitalArtLoader extends Loader
	{
		
		private var _view:MovieClip;
		
		/***********************Constructor*******************************/
		public function DigitalArtLoader(){
			
		}
		/**********************************************************************/
		
		/**********************************Methods*************************/
		
		override public function getView(): DisplayObject {
			return _view;
		}
		
		override public function hide(): void{
			_view.visible=false;
			dispatchEvent(new Event(ON_HIDE_COMPLETE));
		}
		
		override public function load(): void{
			var  al:CustomAssetLoader = CustomAssetLoader.getInstance();
			al.addEventListener(CustomAssetLoader.ON_ASSET_LOAD_COMPLETE,onLoadComplete);
			al.loadAsset("../assets/loader.swf");
		}
		override protected function onLoadComplete(event:Event): void{
			event.target.removeEventListener(CustomAssetLoader.ON_ASSET_LOAD_COMPLETE,onLoadComplete);
			var e:CustomEvent = event as CustomEvent;
			_view = e.data;
			dispatchEvent(new Event(ON_LOAD_COMPLETE));
			
		}
		override public function show(): void{
			_view.visible=true;
			dispatchEvent(new Event(ON_SHOW_COMPLETE));
		}
		
		/**********************************************************************/  
	}//end DigitalArtLoader
}